package com.ssyt.yt1.day29.net;

import java.io.IOException;
import java.net.InetAddress;

/**
 * InetAddress常见操作
 *
 * @author Hsu.
 * @since 2016年1月5日
 */
public class InetAddressDemo {

	public static void main(String[] args) throws IOException {
		InetAddress inetAddress = InetAddress.getByName("111.13.100.92");
		// InetAddress inetAddress = InetAddress.getLocalHost();
		System.out.println("主机/IP地址：" + inetAddress);
		System.out.println("主机：" + inetAddress.getHostName());
		System.out.println("IP:" + inetAddress.getHostAddress());

		InetAddress inetAddress2 = InetAddress.getByName("www.jd.com");
		System.out.println(inetAddress2.isReachable(3000));
	}
}
